#include "util.h"

ios::pos_type length(ifstream &stream)
{
  ios::pos_type begin = stream.tellg();
  stream.seekg(0, ios::end);
  ios::pos_type end = stream.tellg();
  stream.seekg(begin);

  return end-begin;
}


ostream &sethex(ostream &stream)
{
  stream.unsetf(ios::dec | ios::oct);
  stream.setf(ios::hex | ios::uppercase | ios::showbase);

  return stream;
}

// Reset flags.
ostream &reset(ostream &stream)
{
  stream.unsetf(ios::hex | ios::uppercase | ios::showbase);
  stream.setf(ios::dec);
  return stream;
}
